
<?php
 
include("verifierSession.php");
  require_once('connectBD.php');
  include('configuration.php');
  require_once('dao/nomadeDao.php');
  require_once('dao/tacheDao.php');
  require_once('dao/abscenceDao.php');
  require_once('beans/abscenceBean.php');

   extract($_POST);
 
 $datnow=date('d/m/Y');

 $nomadeDao= new nomadeDao();


  $tacheDao= new tacheDao();
 $allTache=$tacheDao->loadAllTache();


if(isset($envoyer)){

//traitement de la fonction insertAbscence

 if(isset($dateAbs) and isset($causeAbs)and isset($designation)){

  $abscence= new AbscenceBean();
  $abscence->setCause($causeAbs);
  $abscence->setDateAbscence($dateAbs);
  $abscence->setDesignation($designation);
  $idNomade=$nomadeDao->loadNomadeByLogin($login)->getIdNomade();
  $abscence->setIdNomade($idNomade);
  $abscenceDao=new AbscenceDao();
  $abscenceDao->insertAbscence($abscence);
  header("location:urgence.php");
  


 }
 
  
 }

if(!isset($envoyer)){
$title="Abscence";
$tpl->assign('title',$title);
 $tpl->assign('d',$datnow);
// $tpl->assign('tabnomade',$allNomade);
 $tpl->assign('tabtache',$allTache); 
 $tpl->display('urgence.html');
}



?>










 